﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiLayerTraits : OdGiDrawableTraits
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiLayerTraits(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiLayerTraits_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiLayerTraits obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiLayerTraits()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiLayerTraits(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiLayerTraits cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiLayerTraits_cast(OdRxObject.getCPtr(pObj));
			OdGiLayerTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiLayerTraits_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiLayerTraits_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiLayerTraits_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiLayerTraits createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiLayerTraits_createObject();
			OdGiLayerTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiLayerTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdCmEntityColor color()
		{
			OdCmEntityColor result = new OdCmEntityColor(GlobalsPINVOKE.OdGiLayerTraits_color(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual LineWeight lineweight()
		{
			LineWeight result = (LineWeight)GlobalsPINVOKE.OdGiLayerTraits_lineweight(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbStub linetype()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiLayerTraits_linetype(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual PlotStyleNameType plotStyleNameType()
		{
			PlotStyleNameType result = (PlotStyleNameType)GlobalsPINVOKE.OdGiLayerTraits_plotStyleNameType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbStub plotStyleNameId()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiLayerTraits_plotStyleNameId(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbStub materialId()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiLayerTraits_materialId(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdCmTransparency transparency()
		{
			OdCmTransparency result = new OdCmTransparency(GlobalsPINVOKE.OdGiLayerTraits_transparency(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setColor(OdCmEntityColor color)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setColor(this.swigCPtr, OdCmEntityColor.getCPtr(color));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setLineweight(LineWeight lineweight)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setLineweight(this.swigCPtr, (int)lineweight);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setLinetype(OdDbStub pLinetypeId)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setLinetype(this.swigCPtr, OdDbStub.getCPtr(pLinetypeId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPlotStyleName(PlotStyleNameType plotStyleNameType, OdDbStub pPlotStyleNameId)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setPlotStyleName__SWIG_0(this.swigCPtr, (int)plotStyleNameType, OdDbStub.getCPtr(pPlotStyleNameId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPlotStyleName(PlotStyleNameType plotStyleNameType)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setPlotStyleName__SWIG_1(this.swigCPtr, (int)plotStyleNameType);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setMaterial(OdDbStub pMaterialId)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setMaterial(this.swigCPtr, OdDbStub.getCPtr(pMaterialId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTransparency(OdCmTransparency transparency)
		{
			GlobalsPINVOKE.OdGiLayerTraits_setTransparency(this.swigCPtr, OdCmTransparency.getCPtr(transparency));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
